The present invention relates to a method and protocol for inter-process communication in a harmonic multi-rate computer system.
Within multi-rate environments, it is often desired and necessary to communicate between many user processes. FIG. 1 shows a broadcast type of protocol where messages are sent from a producer 12 to a plurality of consumers 14, 16, and 18. In addition to being broadcast, some types of inter-process communications are periodic, with producers expected to produce a message every period. Any time two user processes communicate with each other, the consumer must have access to the message produced. Various protocols are used to prevent producers from attempting to store messages into the memory simultaneously being accessed by consumers retrieving messages. One protocol commonly used is a ping-pong buffer that allows consumers to access one memory bank (ping) while the producer writes to the opposite bank (pong).
Systems having multiple rates require many ping/pong memory buffers, typically a ping/pong buffer for each unique sender/receiver rate pair. This configuration creates inefficiencies and slows the system down. For example, a message being consumed by consumers having two different rates requires the creation of two physical copies of the message. The present invention solves these problems of the prior art by providing a time-efficient method and protocol for storing messages for retrieval by consumers, requiring reduced message copying.
The present invention achieves technical advantages as a time-efficient inter-process communicating protocol and method within a harmonic rate system that permits producers and consumers to execute at any combination of rates, and isolates producers and consumers from execution order variations.
In one embodiment, disclosed is a method for periodic broadcast-type inter-process communication for use in a harmonic rate system. The system has a plurality of threads sharing a memory space, where the threads include consuming threads and producing threads have potentially different rates. The producing threads have a period and are adapted to produce a message consumable by the consuming threads. The memory space includes a plurality of buffers for messages produced. The method includes the step of writing a copy of the produced message to a buffer in the memory space during the producing thread""s period. Only one copy of the produced message is written, regardless of the difference in rates between producing and consuming threads.
In another embodiment, disclosed is a protocol for periodic broadcast-type inter-process communication for use in a harmonic rate system. The system has a plurality of threads sharing a memory space and including consuming threads and producing threads having potentially different rates. The producing threads having a period and are adapted to produce a message consumable by the consuming threads. The memory space includes a plurality of buffers for messages produced, where the plurality of buffers include two buffers for each of the rates. The protocol involves writing a copy of the produced message to a buffer in the memory space during the producing thread""s period, where only one copy of the produced message is written, regardless of the difference in rates between producing and consuming threads.